1. Field of the Invention
The present invention relates to an image inspection apparatus, an image inspection method, an image inspection program, and a computer-readable recording medium or a recording device, each using a photometric stereo method.
2. Description of Related Art
There has been used an image inspection apparatus for performing inspection of the presence or absence of a flaw on the surface of a workpiece (inspection target or subject), an external shape thereof, and reading of a printed character thereon. Such an image inspection apparatus performs necessary illumination on a workpiece, captures its image, and performs image processing such as edge detection on the obtained image data, to perform determination such as defective/non-defective determination based on a result of the processing.
However, in such an image inspection apparatus, there has been a case where the viewing easiness varies by a type of illumination or a direction of applying illumination, depending on a type of the workpiece. For this reason, performing appropriate inspection on such a workpiece has required sufficient information and experiences.
Further, in the conventional image inspection apparatus, erroneous inspection is apt to occur due to a small change in illumination condition, installation condition or the like, and stably performing inspection is difficult, which has been problematic. Further, in visual inspection of the workpiece, although both information on a shape of the workpiece such as a flaw and an edge, i.e., three-dimensional information, and planar information such as a printed character and a stain are inspection targets, those information cannot be detected well in some cases as a result of interference of the information, which has also been problematic.
As a technique for solving such problems, there is known an image processing apparatus for acquiring height information by a photometric stereo method (e.g., see Unexamined Japanese Patent Publication No. 2007-206797). Here, the photometric stereo method is one of techniques for three-dimensional measurement where an image is captured by illumination from a plurality of different illumination directions to find a normal vector of a workpiece from shadow information on the image. An image processing apparatus using such a photometric stereo method creates, from a normal vector (corresponding to an inclination image), an image with components on an X-axis and a Y-axis replaced by a luminance value or a reflectance image (corresponding to an albedo image), and applies the image to image inspection. Here, in order to accurately perform three-dimensional measurement by the photometric stereo method, consideration has been made mainly on a method for installation of an illumination device and a method for irradiation with illumination light.
However, in the image inspection by the photometric stereo method, since accurate information of a positional relation between a light source and a workpiece is required for calculating an accurate normal vector, for example when the surface on which the workpiece is placed is inclined from a horizontal plane or illumination is inclined, a number of major changes occur to cause deterioration in accuracy, which has been problematic.
Further, calculating an accurate normal vector requires a great number of images obtained by illumination in different directions, to take enormous amount of processing time, which has also been problematic. On the other hand, even when a height dimension of the workpiece cannot necessarily be accurately detected, it may be sufficient for use in inspection in many cases.